/*
 * Solution.c
 *
 *  Created on: Jun 19, 2021
 *      Author: Rupert
 */

#include "Solution.h"

#include "SignalSource.h"
#include "WaveDetector.h"

#include "stm32f4xx_ll_utils.h"
#include "arm_math.h"

#define R_ref (1e3)
#define DEG2RAD(DEG) (DEG * PI / 180.0)
#define FREQ2OMEGA(FREQ) (2 * PI * FREQ)
#define error_precision (1e-1)
#define phase_error (5.0)
#define ABS_DOUBLE(x) (((x)>=0)?(x):(-1 * x))
#define ValueIn(Value, LLim, HLim) (((Value) > (LLim)) && ((Value) < (HLim)))

static CircuitInfoStructure circuit_info;

void Solution(void)
{
	double hfreq = 10e6,mfreq=500e3, lfreq = 10;
	double mag_hfreq, pha_hfreq;
	double mag_mfreq, pha_mfreq;
	double mag_lfreq, pha_lfreq;
	// 更新高频幅相信息
	setSignalFreq(hfreq);
	LL_mDelay(100);
	mag_hfreq = GetMagnification();
	pha_hfreq = GetPhase(positive);
	LL_mDelay(500);
	// 更新高频幅相信息
	setSignalFreq(mfreq);
	LL_mDelay(100);
	mag_mfreq = GetMagnification();
	pha_mfreq = GetPhase(positive);
	LL_mDelay(500);
	// 更新低频幅相信息
	setSignalFreq(lfreq);
	LL_mDelay(100);
	mag_lfreq = GetMagnification();
	pha_lfreq = GetPhase(positive);
	LL_mDelay(500);

	/*
	 * 在此处理收集到的信号，并更新电路结构信息到结构体
	*/

	// 提示：注意研究Middlewares文件夹下导入的库
}

CircuitInfoStructure* getCircuitInfo(void)
{
	return &circuit_info;
}

